home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / util / boot / snap_v2_0.lha / Snap / Frame.c < prev    next >
Text File  |  1995-09-04  |  1KB  |  67 lines

  1. IMPORT struct RastPort rp;
  2.  
  3. Point OldFrame[9];
  4. Point NewFrame[9];
  5. LONG OFType = 0;
  6. UWORD Ptrn;
  7.  
  8. STATIC VOID MultiDraw( struct RastPort *rp, LONG num, Point *xy)
  9. {
  10.     REGISTER LONG i = 0;
  11.     REGISTER Point *coord = xy;
  12.  
  13.     while (i < num)
  14.     {
  15.         Move(rp, (LONG) coord->x, (LONG) coord->y);
  16.         coord++;
  17.         Draw(rp, (LONG) coord->x, (LONG) coord->y);
  18.         i++;
  19.     }
  20. }
  21.  
  22. VOID crawl_frame( LONG dir)
  23. {
  24.     REGISTER UWORD temp = Ptrn;
  25.  
  26.     if (dir)
  27.     {
  28.         Ptrn = ((Ptrn << 1) & 0xfffe) | ((Ptrn & 0x8000) >> 15);
  29.     }
  30.     else
  31.     {
  32.         Ptrn = ((Ptrn >> 1) & 0x7fff) | ((Ptrn & 1) << 15);
  33.     }
  34.     temp ^= Ptrn;
  35.     SetDrPt(&rp, temp);
  36.     MultiDraw(&rp, OFType, &OldFrame[0]);
  37.     SetDrPt(&rp, Ptrn);
  38. }
  39.  
  40. VOID erase_frame( void)
  41. {
  42.     if (OFType)
  43.     {
  44.         MultiDraw(&rp, OFType, &OldFrame[0]);
  45.         OFType = 0;
  46.     }
  47. }
  48.  
  49. VOID draw_frame( LONG ft)
  50. {
  51.     REGISTER LONG i;
  52.  
  53.     /* Remove old frame */
  54.     WaitTOF();
  55.     erase_frame();
  56.     /* Draw the new frame */
  57.     SetDrPt(&rp, Ptrn);
  58.     MultiDraw(&rp, ft, &NewFrame[0]);
  59.     /* save the frame for erasing later */
  60.     for (i = 0; i <= ft; i++)
  61.     {
  62.         OldFrame[i].x = NewFrame[i].x;
  63.         OldFrame[i].y = NewFrame[i].y;
  64.     }
  65.     OFType = ft;
  66. }
  67.